gridpack::math Namespace Reference

Namespaces

namespace  fallback

Classes

class  BasicLinearMatrixSolverImplementation
struct  base_unary_function
struct  setvalue
struct  addvalue
struct  multiplyvalue
struct  absvalue
struct  absvalue< RealType >
struct  absvalue< ComplexType >
struct  exponential
struct  reciprocal
struct  conjugate_value
struct  real_value
struct  imaginary_value
struct  base_accumulator_function
struct  l1_norm
struct  l2_norm
struct  infinity_norm
struct  base_binary_function
struct  multiplyvalue2
struct  dividevalue2
struct  scaleAdd2
class  DAESolverT
 A solver for systems differential algebraic equations (DAE). More...
struct  DAEBuilder
class  DAESolverImplementation
class  DAESolverInterface
class  ImplementationVisitable
 Interface for classes that accept ImplementationVisitor's. More...
class  ImplementationVisitor
class  ConstImplementationVisitor
class  LinearMatrixSolverT
 A solver for multiple systems of linear equations. More...
class  LinearMatrixSolverImplementation
class  BaseLinearMatrixSolverInterface
class  LinearSolverT
 A solver for system(s) of linear equations in parallel. More...
class  LinearSolverImplementation
class  BaseLinearSolverInterface
class  MatrixT
 A parallel or serial matrix of real values. More...
class  MatrixImplementation
class  BaseMatrixInterface
 Abstract interface for matrix classes. More...
class  NewtonRaphsonSolverT
 Solve a system of nonlinear equations using the Newton-Raphson method in parallel. More...
class  NewtonRaphsonSolverImplementation
 Implementation of Newton-Raphson method to solve a system of nonlinear equations in parallel. More...
class  NonlinearSolverT
 A solver for a system of nonlinear system of equations in parallel. More...
struct  NLSBuilder
class  NonlinearSolverImplementation
class  NonlinearSolverInterface
 Interface to a solve system of nonlinear equations in parallel. More...
struct  TypeCheck
 This is used to make sure the numeric type is supported. More...
class  ValueTransfer
class  ValueTransferToLibrary
class  ValueTransferFromLibrary
class  MatrixValueTransferToLibrary
class  MatrixValueTransferFromLibrary
struct  storage_size
 Get the number of library elements used to represent a scalar. More...
class  VectorT
 A parallel or serial vector of values. More...
class  VectorImplementation
class  BaseVectorInterface

Typedefs

typedef DAESolverT< ComplexTypeComplexDAESolver
typedef DAESolverT< RealTypeRealDAESolver
typedef ComplexDAESolver DAESolver
typedef LinearMatrixSolverT
< ComplexType
ComplexLinearMatrixSolver
typedef LinearMatrixSolverT
< RealType
RealLinearMatrixSolver
typedef ComplexLinearMatrixSolver LinearMatrixSolver
typedef LinearSolverT
< ComplexType
ComplexLinearSolver
typedef LinearSolverT< RealTypeRealLinearSolver
typedef ComplexLinearSolver LinearSolver
typedef MatrixT< ComplexTypeComplexMatrix
typedef MatrixT< RealTypeRealMatrix
typedef ComplexMatrix Matrix
 The main matrix type.
typedef NewtonRaphsonSolverT
< ComplexType
ComplexNewtonRaphsonSolver
typedef NewtonRaphsonSolverT
< RealType
RealNewtonRaphsonSolver
typedef ComplexNewtonRaphsonSolver NewtonRaphsonSolver
typedef NonlinearSolverT
< ComplexType
ComplexNonlinearSolver
typedef NonlinearSolverT
< RealType
RealNonlinearSolver
typedef ComplexNonlinearSolver NonlinearSolver
typedef NLSBuilder
< ComplexType >::Jacobian 
ComplexJacobianBuilder
typedef NLSBuilder
< ComplexType >::Function 
ComplexFunctionBuilder
typedef NLSBuilder< RealType >
::Jacobian 
RealJacobianBuilder
typedef NLSBuilder< RealType >
::Function 
RealFunctionBuilder
typedef class VectorT
< ComplexType
ComplexVector
typedef class VectorT< double > RealVector
typedef ComplexVector Vector

Enumerations

enum  MatrixStorageType { Dense, Sparse }
 

The types of matrices that can be created.

More...

Functions

template<typename To , typename From >
To equate (const From &f)
template<>
RealType equate< RealType, ComplexType > (const ComplexType &f)
template<typename T , typename StorageType >
void unary_operation (const unsigned int &size, StorageType *x, base_unary_function< T > &op)
template<>
void unary_operation< ComplexType, RealType > (const unsigned int &size, RealType *x, base_unary_function< ComplexType > &op)
template<>
void unary_operation< RealType, ComplexType > (const unsigned int &size, ComplexType *x, base_unary_function< RealType > &op)
template<typename T , typename StorageType >
void accumulator_operation (const unsigned int &size, const StorageType *x, base_accumulator_function< T, RealType > &op)
template<>
void accumulator_operation< RealType, ComplexType > (const unsigned int &size, const ComplexType *x, base_accumulator_function< RealType, RealType > &op)
template<>
void accumulator_operation< ComplexType, RealType > (const unsigned int &size, const RealType *x, base_accumulator_function< ComplexType, RealType > &op)
template<typename T , typename StorageType >
void binary_operation (const unsigned int &size, StorageType *x1, const StorageType *x2, base_binary_function< T > &op)
template<>
void binary_operation< ComplexType, RealType > (const unsigned int &size, RealType *x1, const RealType *x2, base_binary_function< ComplexType > &op)
template<>
void binary_operation< RealType, ComplexType > (const unsigned int &size, ComplexType *x1, const ComplexType *x2, base_binary_function< RealType > &op)
void Initialize (int *, char ***)
bool Initialized (void)
 Is the math library initialized?
void Finalize (void)
 Do whatever is necessary to shut down the math library.
template<typename T , typename I >
void add (const MatrixT< T, I > &A, const MatrixT< T, I > &B, MatrixT< T, I > &result)
 Add two Matrix instances and put the result in a third.
template<typename T , typename I >
void transpose (const MatrixT< T, I > &A, MatrixT< T, I > &result)
 Make the transpose of a Matrix and put it in another.
template<typename T , typename I >
void column (const MatrixT< T, I > &A, const int &cidx, VectorT< T, I > &x)
 Get a column from the Matrix and put in specified Vector.
template<typename T , typename I >
void diagonal (const MatrixT< T, I > &A, VectorT< T, I > &x)
 Get the diagonal from a Matrix and put it in specified Vector.
template<typename T , typename I >
void multiply (const MatrixT< T, I > &A, const MatrixT< T, I > &B, MatrixT< T, I > &result)
 Multiply two Matrix instances and put result in existing Matrix.
template<typename T , typename I >
void multiply (const MatrixT< T, I > &A, const VectorT< T, I > &x, VectorT< T, I > &result)
 Multiply a Matrix by a Vector and put result in existing Vector.
template<typename T , typename I >
void transposeMultiply (const MatrixT< T, I > &A, const VectorT< T, I > &x, VectorT< T, I > &result)
 Multiply the transpose of a Matrix by a Vector and put the result in existing Vector.
template<typename T , typename I >
MatrixT< T, I > * add (const MatrixT< T, I > &A, const MatrixT< T, I > &B)
 Add two Matrix instances.
template<typename T , typename I >
MatrixT< T, I > * transpose (const MatrixT< T, I > &A)
 Make the transpose of a Matrix.
template<typename T , typename I >
VectorT< T, I > * column (const MatrixT< T, I > &A, const int &cidx)
 Get a column from the Matrix and put in new Vector.
template<typename T , typename I >
VectorT< T, I > * diagonal (const MatrixT< T, I > &A)
 Get the diagonal from a Matrix and put in new Vector.
template<typename T , typename I >
MatrixT< T, I > * diagonal (const VectorT< T, I > &x, const MatrixStorageType &stype=Sparse)
 Make a diagonal Matrix from a Vector.
template<typename T , typename I >
MatrixT< T, I > * multiply (const MatrixT< T, I > &A, const MatrixT< T, I > &B)
 Multiply two Matrix instances and make a new one.
template<typename T , typename I >
VectorT< T, I > * multiply (const MatrixT< T, I > &A, const VectorT< T, I > &x)
 Multiply a Matrix by a Vector and make a new Vector for the result.
template<typename T , typename I >
VectorT< T, I > * transposeMultiply (const MatrixT< T, I > &A, const VectorT< T, I > &x)
 Multiply the transpose of a Matrix by a Vector and make a new Vector for the result.
template<typename T , typename I >
MatrixT< T, I > * identity (const MatrixT< T, I > &A)
 Make an identity matrix with the same ownership as the specified matrix.
template<typename T , typename I >
MatrixT< T, I > * real (const MatrixT< T, I > &A)
 Create a new matrix containing the real part of the specified matrix.
template<typename T , typename I >
MatrixT< T, I > * imaginary (const MatrixT< T, I > &A)
 Create a new matrix containing the imaginary part of the specified matrix.
template<typename T , typename I >
MatrixT< T, I > * conjugate (const MatrixT< T, I > &A)
 Create a new matrix containing the complex conjugate of the specified matrix.
template<typename T , typename I >
MatrixT< T, I > * storageType (const MatrixT< T, I > &A, const MatrixStorageType &new_type)
 Create a copy of a Matrix, possibly with a different storage type.
template<typename T , typename I >
MatrixT< T, I > * matrixLoadBinary (const parallel::Communicator &comm, const char *filename)
 Create a new matrix and load its contents from the specified (binary) file.
template<typename T , typename I >
VectorT< T, I > * add (const VectorT< T, I > &A, const VectorT< T, I > &B)
 Add two Vector instances and put the result in a new one.
template<typename T , typename I >
VectorT< T, I > * abs (const VectorT< T, I > &x)
 Subtract two Vector instances and put the result in a new one.
template<typename T , typename I >
VectorT< T, I > * real (const VectorT< T, I > &x)
 Create a vector containing the real part of the specified vector.
template<typename T , typename I >
VectorT< T, I > * imaginary (const VectorT< T, I > &x)
 Create a vector containing the imaginar part of the specified vector.
template<typename T , typename I >
VectorT< T, I > * conjugate (const VectorT< T, I > &x)
 Create a vector containing the complex conjugate of x.
template<typename T , typename I >
void add (const VectorT< T, I > &A, const VectorT< T, I > &B, VectorT< T, I > &result)
 Add two Vector instances and put the result in an existing Vector.

Typedef Documentation

The main matrix type.

typedef class VectorT< double > gridpack::math::RealVector

Enumeration Type Documentation

The types of matrices that can be created.

The gridpack::math library provides two storage schemes for matrices. This is used by Matrix and MatrixImplementation subclasses.

The actual storage scheme and memory used is dependent upon the underlying math library implementation.

Enumerator:
Dense 

dense matrix storage scheme

Sparse 

sparse matrix storage scheme


Function Documentation

template<typename T , typename I >
VectorT<T, I>* gridpack::math::abs ( const VectorT< T, I > &  x  ) 

Subtract two Vector instances and put the result in a new one.

Collective.

A and B must have the global size and use the same communicator, but may have different local sizes.

The resultant vector instance will have the same parallel distribution as A.

Parameters:
A 
B 
Returns:
pointer to new allocated Vector instance Create a vector containing the absolute value/magnitude of the specified vector

References gridpack::math::VectorT< T, I >::clone().

template<typename T , typename StorageType >
void gridpack::math::accumulator_operation ( const unsigned int &  size,
const StorageType *  x,
base_accumulator_function< T, RealType > &  op 
)
template<>
void gridpack::math::accumulator_operation< ComplexType, RealType > ( const unsigned int &  size,
const RealType *  x,
base_accumulator_function< ComplexType, RealType > &  op 
)
template<>
void gridpack::math::accumulator_operation< RealType, ComplexType > ( const unsigned int &  size,
const ComplexType *  x,
base_accumulator_function< RealType, RealType > &  op 
)
template<typename T , typename I >
void gridpack::math::add ( const VectorT< T, I > &  A,
const VectorT< T, I > &  B,
VectorT< T, I > &  result 
)

Add two Vector instances and put the result in an existing Vector.

Collective.

A, B, and result need to have the same global size and use the same communicator, but may have different local sizes.

Parameters:
A 
B 
result vector in which to place the sum of A and B

References gridpack::math::VectorT< T, I >::add(), and gridpack::math::VectorT< T, I >::equate().

template<typename T , typename I >
VectorT<T, I>* gridpack::math::add ( const VectorT< T, I > &  A,
const VectorT< T, I > &  B 
)

Add two Vector instances and put the result in a new one.

Collective.

A and B must have the global size and use the same communicator, but may have different local sizes.

The resultant vector instance will have the same parallel distribution as A.

Parameters:
A 
B 
Returns:
pointer to new allocated Vector instance

References gridpack::math::VectorT< T, I >::clone().

template<typename T , typename I >
MatrixT<T, I>* gridpack::math::add ( const MatrixT< T, I > &  A,
const MatrixT< T, I > &  B 
)

Add two Matrix instances.

Collective.

A and B must have the same communicator and the same size. Different parallel distributions and nonzero patterns are OK, though.

Parameters:
A 
B 
Returns:
pointer to new Matrix containing A+B

References add(), and gridpack::math::MatrixT< T, I >::clone().

template<typename T , typename I >
void gridpack::math::add ( const MatrixT< T, I > &  A,
const MatrixT< T, I > &  B,
MatrixT< T, I > &  result 
)

Add two Matrix instances and put the result in a third.

References gridpack::math::MatrixT< T, I >::add(), and gridpack::math::MatrixT< T, I >::equate().

template<typename T , typename StorageType >
void gridpack::math::binary_operation ( const unsigned int &  size,
StorageType *  x1,
const StorageType *  x2,
base_binary_function< T > &  op 
)

This function combines two arrays of type T that are stored as type StorageType using some operation. The values in x1 are replaced with the result of the operation.

In this implementation, it is assumed that types T and StorageType are the same or castable to each other and that one StorageType element is used to represent one T element.

Parameters:
size 
x1 
x2 
op 
template<>
void gridpack::math::binary_operation< ComplexType, RealType > ( const unsigned int &  size,
RealType *  x1,
const RealType *  x2,
base_binary_function< ComplexType > &  op 
)

This function combines two arrays of type T that are stored as type StorageType using some operation. The values in x1 are replaced with the result of the operation.

In this specialization, ComplexType values are stored in a RealType vector, two RealType values are used for each ComplexType. So, temporary ComplexType's are made from 2 RealType entries, operated on, then split back into two RealType elements.

Parameters:
size 
x1 
x2 
op 
Returns:
template<>
void gridpack::math::binary_operation< RealType, ComplexType > ( const unsigned int &  size,
ComplexType *  x1,
const ComplexType *  x2,
base_binary_function< RealType > &  op 
)

This function combines two arrays of type T that are stored as type StorageType using some operation. The values in x1 are replaced with the result of the operation.

Parameters:
size 
x1 
x2 
op 
Returns:
template<typename T , typename I >
VectorT<T, I>* gridpack::math::column ( const MatrixT< T, I > &  A,
const int &  cidx 
)

Get a column from the Matrix and put in new Vector.

Parameters:
A 
cidx 
Returns:

References gridpack::parallel::WrappedDistributed::communicator(), and gridpack::math::BaseMatrixInterface< T, I >::localRows().

template<typename T , typename I >
void gridpack::math::column ( const MatrixT< T, I > &  A,
const int &  cidx,
VectorT< T, I > &  x 
)

Get a column from the Matrix and put in specified Vector.

Parameters:
A 
cidx 
x 
template<typename T , typename I >
VectorT<T, I>* gridpack::math::conjugate ( const VectorT< T, I > &  x  ) 

Create a vector containing the complex conjugate of x.

Parameters:
x existing vector with complex values
Returns:
pointer to new vector instance containing the complex conjugate of x

References gridpack::math::VectorT< T, I >::clone().

template<typename T , typename I >
MatrixT<T, I>* gridpack::math::conjugate ( const MatrixT< T, I > &  A  ) 

Create a new matrix containing the complex conjugate of the specified matrix.

References gridpack::math::MatrixT< T, I >::clone(), and gridpack::math::BaseMatrixInterface< T, I >::conjugate().

template<typename T , typename I >
MatrixT<T, I>* gridpack::math::diagonal ( const VectorT< T, I > &  x,
const MatrixStorageType &  stype = Sparse 
)
template<typename T , typename I >
VectorT<T, I>* gridpack::math::diagonal ( const MatrixT< T, I > &  A  ) 

Get the diagonal from a Matrix and put in new Vector.

Collective.

Parameters:
A 
Returns:
pointer to new, allocated Vector containing the diagonal elements of A

References gridpack::parallel::WrappedDistributed::communicator(), and gridpack::math::BaseMatrixInterface< T, I >::localRows().

template<typename T , typename I >
void gridpack::math::diagonal ( const MatrixT< T, I > &  A,
VectorT< T, I > &  d 
)

Get the diagonal from a Matrix and put it in specified Vector.

Parameters:
A 
x 

Get the diagonal from a Matrix and put it in specified Vector.

Collective.

Parameters:
A 
x 
Returns:
pointer to new, allocated Vector containing the diagonal elements of A

References gridpack::math::BaseMatrixInterface< T, I >::getElement(), gridpack::math::BaseMatrixInterface< T, I >::localRowRange(), gridpack::math::BaseVectorInterface< T, I >::ready(), and gridpack::math::BaseVectorInterface< T, I >::setElement().

template<typename To , typename From >
To gridpack::math::equate ( const From &  f  ) 

This allows a general way to do "x = y"

Parameters:
f 
Returns:
template<>
RealType gridpack::math::equate< RealType, ComplexType > ( const ComplexType &  f  ) 
void gridpack::math::Finalize ( void   ) 

Do whatever is necessary to shut down the math library.

template<typename T , typename I >
MatrixT<T, I>* gridpack::math::identity ( const MatrixT< T, I > &  A  ) 

Make an identity matrix with the same ownership as the specified matrix.

References gridpack::math::MatrixT< T, I >::clone().

template<typename T , typename I >
VectorT<T, I>* gridpack::math::imaginary ( const VectorT< T, I > &  x  ) 

Create a vector containing the imaginar part of the specified vector.

Parameters:
x existing vector with complex values
Returns:
pointer to new vector instance containing imaginary part of x

References gridpack::math::VectorT< T, I >::clone().

template<typename T , typename I >
MatrixT<T, I>* gridpack::math::imaginary ( const MatrixT< T, I > &  A  ) 

Create a new matrix containing the imaginary part of the specified matrix.

References gridpack::math::MatrixT< T, I >::clone(), and gridpack::math::BaseMatrixInterface< T, I >::imaginary().

void gridpack::math::Initialize ( int *  ,
char ***   
)
bool gridpack::math::Initialized ( void   ) 

Is the math library initialized?

template<typename T , typename I >
MatrixT<T, I>* gridpack::math::matrixLoadBinary ( const parallel::Communicator &  comm,
const char *  filename 
)

Create a new matrix and load its contents from the specified (binary) file.

template<typename T , typename I >
VectorT<T, I>* gridpack::math::multiply ( const MatrixT< T, I > &  A,
const VectorT< T, I > &  x 
)

Multiply a Matrix by a Vector and make a new Vector for the result.

Parameters:
A 
x 
Returns:

References gridpack::parallel::WrappedDistributed::communicator(), and gridpack::math::BaseMatrixInterface< T, I >::localRows().

template<typename T , typename I >
MatrixT<T, I>* gridpack::math::multiply ( const MatrixT< T, I > &  A,
const MatrixT< T, I > &  B 
)

Multiply two Matrix instances and make a new one.

Parameters:
A 
B 
Returns:
template<typename T , typename I >
void gridpack::math::multiply ( const MatrixT< T, I > &  A,
const VectorT< T, I > &  x,
VectorT< T, I > &  result 
)

Multiply a Matrix by a Vector and put result in existing Vector.

A, x, and result must all have the same communicator. x and result must be the same size. The length of x must be the number of columns in A. If these conditions are not met, an exception is thrown.

Parameters:
A 
x 
result 
template<typename T , typename I >
void gridpack::math::multiply ( const MatrixT< T, I > &  A,
const MatrixT< T, I > &  B,
MatrixT< T, I > &  result 
)

Multiply two Matrix instances and put result in existing Matrix.

Parameters:
A 
B 
result 
template<typename T , typename I >
VectorT<T, I>* gridpack::math::real ( const VectorT< T, I > &  x  ) 

Create a vector containing the real part of the specified vector.

Parameters:
x existing vector with complex values
Returns:
pointer to new vector instance containing real part of x

References gridpack::math::VectorT< T, I >::clone().

template<typename T , typename I >
MatrixT<T, I>* gridpack::math::real ( const MatrixT< T, I > &  A  ) 

Create a new matrix containing the real part of the specified matrix.

References gridpack::math::MatrixT< T, I >::clone(), and gridpack::math::BaseMatrixInterface< T, I >::real().

template<typename T , typename I >
MatrixT<T, I>* gridpack::math::storageType ( const MatrixT< T, I > &  A,
const MatrixStorageType &  new_type 
)

Create a copy of a Matrix, possibly with a different storage type.

template<typename T , typename I >
MatrixT<T, I>* gridpack::math::transpose ( const MatrixT< T, I > &  A  ) 

Make the transpose of a Matrix.

Collective.

Parameters:
A 
Returns:
pointer to a new Matrix containing AT
template<typename T , typename I >
void gridpack::math::transpose ( const MatrixT< T, I > &  A,
MatrixT< T, I > &  result 
)

Make the transpose of a Matrix and put it in another.

Parameters:
A 
result 
template<typename T , typename I >
VectorT<T, I>* gridpack::math::transposeMultiply ( const MatrixT< T, I > &  A,
const VectorT< T, I > &  x 
)

Multiply the transpose of a Matrix by a Vector and make a new Vector for the result.

Parameters:
A 
x 
Returns:

References gridpack::parallel::WrappedDistributed::communicator(), and gridpack::math::BaseVectorInterface< T, I >::localSize().

template<typename T , typename I >
void gridpack::math::transposeMultiply ( const MatrixT< T, I > &  A,
const VectorT< T, I > &  x,
VectorT< T, I > &  result 
)

Multiply the transpose of a Matrix by a Vector and put the result in existing Vector.

Parameters:
A 
x 
result same size and distribution as x
template<typename T , typename StorageType >
void gridpack::math::unary_operation ( const unsigned int &  size,
StorageType *  x,
base_unary_function< T > &  op 
)

This function applies an operator to each element in an array of type T that is stored in an array of type StorageType. The values array are replaced.

In this implementation, it is assumed that types T and StorageType are the same or castable to each other.

Parameters:
size the number of type T elements to be operated on
x the elements stored as StorageType
op 
template<>
void gridpack::math::unary_operation< ComplexType, RealType > ( const unsigned int &  size,
RealType *  x,
base_unary_function< ComplexType > &  op 
)

In this specialization, ComplexType values are stored in a RealType vector, two RealType values are used for each ComplexType. So, a temporary ComplexType is made from 2 RealType entries, operated on, then split back into two RealType elements.

Parameters:
size 
x 
op 
Returns:
template<>
void gridpack::math::unary_operation< RealType, ComplexType > ( const unsigned int &  size,
ComplexType *  x,
base_unary_function< RealType > &  op 
)

In this specialization, RealType values are stored in a ComplexType array. It is assumed that only the real part is used.

Parameters:
size 
x 
op 
Returns:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

Generated on 3 Feb 2020 for GridPACK by  doxygen 1.6.1